const gulp = require('gulp');
const fs = require('fs');
const source = require('vinyl-source-stream');
const browserify = require('browserify');
const uglify = require('gulp-uglify');
const streamify = require('gulp-streamify');
const babelify = require('babelify');
const gsap = require('gsap');
const glslify = require('glslify');


function compileJS(file){
	browserify(`src/${file}.js`,{debug:true})
        .transform(babelify)
        .transform('glslify')
        .bundle()
        .on('error', err=>{
        	console.log(`Error:${err.message}`);
        })
        .pipe(source(`${file}.js`))
        //.pipe(streamify(uglify()))
        .pipe(gulp.dest(`dist/js/`));

}


gulp.task('default',()=>{
	compileJS('webgl');
	
	
	});

